-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pprof to all VPA components #7153
Conversation
Hi @adrianmoisey. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@kwiesmueller any chance you can look at this? |
/assign @voelzmo @raywainman |
vertical-pod-autoscaler/go.mod
Outdated
@@ -13,6 +13,7 @@ require ( | |||
golang.org/x/time v0.4.0 | |||
k8s.io/api v0.28.3 | |||
k8s.io/apimachinery v0.28.3 | |||
k8s.io/apiserver v0.0.0-00010101000000-000000000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird that it is using a pseudo-version number... Do you know why it is importing this?
What happens if you try to pull in a specific version? Maybe we can use the same as cluster autoscaler?
autoscaler/cluster-autoscaler/go.mod
Line 47 in 386f0f7
k8s.io/apiserver v0.31.0-beta.0 |
(I'm not an expert in this so sorry if this is totally off - this just looks weird to me)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 679d6bd fixes it
I used 0.28.3, since that's what the VPA currently uses
metrics_admission.Register() | ||
|
||
go func() { | ||
pathRecorderMux := mux.NewPathRecorderMux("vertical-pod-autoscaler") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reading the documentation and it looks like this name is used for logging, should we make this unique across each binary?
eg. here we would make it vertical-pod-autoscaler-admission-controller
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e4fc614
/lgtm |
/ok-to-test |
/assign voelzmo |
Hey @voelzmo can you approve this? |
metrics_admission.Register() | ||
|
||
go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to put this block into some shared util package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 7ec04b3
pathRecorderMux := mux.NewPathRecorderMux("vertical-pod-autoscaler-admission-controller") | ||
|
||
if *enableProfiling { | ||
routes.Profiling{}.Install(pathRecorderMux) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is depending on the apiserver package the best practice here? I'm not sure if that's entirely safe as they may add profiling things that don't fully match.
Might there be something similar focused on api clients (as we're not really apiservers, even though at least the admission controller is serving).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, valid point.
I can't any client side library that includes a pprof function that can be reused.
Since your other comment is suggesting that this chunk of code gets moved to a central place to be re-used, I'll just manually setup the pprof paths there, rather than bringing in a new dependancy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 7ec04b3
Something I realised, is that I copied the cluster-autoscaler way of adding pprof, see:
autoscaler/cluster-autoscaler/main.go
Lines 689 to 691 in 77bf580
if *enableProfiling { | |
routes.Profiling{}.Install(pathRecorderMux) | |
} |
I do agree that for adding pprof it doesn't make sense to add an entire new dependency, so may be that's an opportunity to go clean up cluster-autoscaler too.
Thanks for sending this! Very nice to get profiling added. |
e4fc614
to
7ec04b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adrianmoisey, kwiesmueller The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Add proof to all 3 VPA components.
Which issue(s) this PR fixes:
Fixes #6946
Special notes for your reviewer:
The change was inspired by the cluster-autoscaler implementation of pprof. I figured it made sense to move a lot of the logic out of the metrics package, as that code handled metrics, health check and pprof.
EDIT: I don't know if I handled the dependencies and vendoring correctly, so I left them in their own commit in case that needs to be changed.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: